package com.sert.pet.manager;

import java.util.ArrayList;
import java.util.List;

import com.sert.pet.IPet;
import com.sert.pet.entity.Dog;

public class PetList {
	
	private List<IPet> petList=null;
	
	public List<IPet> getPetList() {
		return petList;
	}

	public void setPetList(List<IPet> petList) {
		this.petList = petList;
	}

	public PetList(){
		petList=new ArrayList<IPet>();
	}
	
	

	/**
	 * 按名字查找
	 * @param name 要查找的名字
	 * @return 查找到的下标
	 */
	public int findOneByName(String name){
		
		int falg=-1;
		for(int i=0;i<petList.size();i++){
			IPet ip = petList.get(i);
			if(name.equals(ip.getName())){
				falg=i;
				break;
			}
		}
		return falg;
	}
	
	public void findAll(){
		for (IPet iPet : petList) {
			System.out.println(iPet);
		}
		
	}

}
